package com.example.springtask.serializer;

import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;

import java.io.ObjectInput;
import java.io.ObjectInputStream;

public class CustomerDeserializer implements org.apache.kafka.common.serialization.Deserializer<Object> {

    @Override
    public Object deserialize(String topic, byte[] bytes) {
        try(ByteInputStream bis = new ByteInputStream(bytes,bytes.length)){
            ObjectInput objectInput = new ObjectInputStream(bis);
            return objectInput.readObject();
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
}
